﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using InnvoiceActual.BaseDeDatos.innvoicedbDataSetTableAdapters;
using System.Data;
using InnvoiceActual.Logica.GestorObject;
using System.Windows;

namespace InnvoiceActual.Logica.GestorDB
{
    class PaisDB
    {
        public void addPaises() { }

        public List<PaisCS> obtenerPaises()
        {
            List<PaisCS> misPaises = new List<PaisCS>();
            paisTableAdapter tablaPaises = new paisTableAdapter();
            DataTable mitablaresult = new DataTable();

            try
            {
                mitablaresult = tablaPaises.GetData();
                foreach (DataRow items in mitablaresult.Rows)
                {
                    PaisCS dataPaises = new PaisCS();

                    dataPaises.Codigo_pais = Convert.ToInt16(items["codigopais"].ToString());
                    dataPaises.Descripcion = items["descripcion"].ToString();

                    misPaises.Add(dataPaises);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("PaisDB - ObetenerPaises", "Error", MessageBoxButton.OK);
            }
            return misPaises;
        }

        public void insertarPais(String auxPais) { }

        public bool deletePais(int auxPais) { return true; }

        public void modificarPais(int auxPais, string descripPais) { }
    }
}
